package com.example.review;


import java.util.Scanner;

//求 n 的阶乘 factorial of n n!，n 为用户输入的正整数
public class Factorial {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("please input n:");
        int n = scanner.nextInt();
        System.out.println(n+"的阶乘是："+jiecheng(n));

    }
    private static long jiecheng(int n){
        if(n == 0){
            return 1;
        }else {
            return n*jiecheng(n-1);
        }

    }
}
